<? include 'server_config.php'; 

if($_SESSION['user_idx'] == "")
{
	?>
	<script>
		location.href='login.php';
	</script>
	<?
	return;
}


$user_img = "../ndd/upload/member_photo/".$_SESSION['user_idx'];

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
	<title> New Document </title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="Stylesheet" type="text/css" href="./css/nddCommon.css" />
	<script type="text/javascript" src="./js/jquery-1.6.2.min.js"></script>
	
</head>

 <body>
	<div id='wrapper'>
		<?
        include "top_menu.php";
        ?>
		
		<div id='left_bg'>
		</div>


		<div id='title'>
			<div id='title_margin_top'><span></span></div>
			<div style='width:195px;height:29px;float:left;'></div>
			<div style='width:41px;height:29px;float:left;'><img src="./img/top_icon_input.png"></div><div style='height:29px;float:left;margin-top:3px;'><span id='article_content' >기본 건강정보를 입력해주세요</span></div>
		</div>
		
		<?
		$current_file = basename(__FILE__);
		include 'side_menu_input.php';
		?>


		<div id='middle_bg'>
		</div>


<?
			$disease_idx=0;

			$sql="
				SELECT q1,q2,q3,q4,q5,q6,q7, q7_1, q7_2 FROM ndd_disease_basic WHERE user_idx = $user_idx AND disease_idx = $disease_idx LIMIT 1;
			";
			
			//echo $sql;

			$result = mysql_query($sql,$connect);

			$row = mysql_fetch_row($result);
			
//0066CC
?>		

		<div id='document_content' style="width:776px;float:left;">
			<div style='height:2px;width:100%;background:#cccccc;float:left;'><span><span></div>
			<div style='height:3px;width:100%;float:left;'><span><span></div>

			<div style="width:714px;background:#F2F2F2;float:left;border:1px solid #E9E9E9;padding:30px;">
				<div style="width:30px;height:30px;float:left;">1</div>
				<div style="width:600px;float:left;">
					"류마티스 관절염"이라고 진단받았습니까?<br>
					<br/>
					&nbsp;<input type="radio" name="q1" id="q1" <? if ($row[0]=="Y") echo "checked"; ?> onclick="div_expand();"> 예 <br>
					&nbsp;<input type="radio" name="q1" id="q1" <? if ($row[0]=="N") echo "checked"; ?> onclick="div_expand();"> 아니오 <br>
					<br>
					<div id="div_q2" style="display:none;">
					언제 진단받았습니까?<br>
					<input type="text" value="<? if ($row[1]=="") { echo date('Y-m-d'); } else echo $row[1];?>" id="q2"><br>
					</div>
			
				</div>
	
		
				<iframe name="iframe_temp" style='display:none;'></iframe>
		
		
				<div style="width:100%;height:15px;float:left;"><span></span></div>

				<div style="width:100%;height:1px;background:gray;float:left;"><span></span></div>
				<div style="width:100%;height:2px;background:#ffffff;float:left;"><span></span></div>

				<div style="width:100%;height:15px;float:left;"><span></span></div>
				<br/>

				<div style="width:30px;height:30px;float:left;">2</div>
				<div style="width:600px;float:left;">
					증상이 있습니까?<br>
					<br/>
					&nbsp;<input type="radio" name="q3" id="q3" <? if ($row[2]=="Y") echo "checked"; ?> onclick="div_expand();"> 예 <br>
					&nbsp;<input type="radio" name="q3" id="q3" <? if ($row[2]=="N") echo "checked"; ?> onclick="div_expand();"> 아니오 <br>
					<br>
					<div id="div_q4" style="display:none;">
					언제 증상이 시작되었습니까?<br>
					<input type="text" value="<? if ($row[3]=="") { echo date('Y-m-d'); } else echo $row[3];?>" id="q4"><br>
					</div>
				
				</div>

				<div style="width:100%;height:15px;float:left;"><span></span></div>

				<div style="width:100%;height:1px;background:gray;float:left;"><span></span></div>
				<div style="width:100%;height:2px;background:#ffffff;float:left;"><span></span></div>

				<div style="width:100%;height:15px;float:left;"><span></span></div>
				<br/>

				<div style="width:30px;height:30px;float:left;">3</div>
				<div style="width:600px;float:left;">
					현재 류마티스 관절염을 치료하고 있습니까?<br>
					<br>
					<input type="radio" name="q5" id="q5" <? if ($row[4]=="Y") echo "checked"; ?>> 예 <br>
					<input type="radio" name="q5" id="q5" <? if ($row[4]=="N") echo "checked"; ?>> 아니오 <br>
				
				</div>

				<div style="width:100%;height:15px;float:left;"><span></span></div>

				<div style="width:100%;height:1px;background:gray;float:left;"><span></span></div>
				<div style="width:100%;height:2px;background:#ffffff;float:left;"><span></span></div>

				<div style="width:100%;height:15px;float:left;"><span></span></div>
				<br/>


				<div style="width:30px;height:30px;float:left;">4</div>
				<div style="width:600px;float:left;">
					가족 중에 자가면역질환을 앓고 계신 분이 있습니까?<br>
					<br>
					<input type="radio" name="q6" id="q6" <? if ($row[5]=="Y") echo "checked"; ?>> 예 <br>
					<input type="radio" name="q6" id="q6" <? if ($row[5]=="N") echo "checked"; ?>> 아니오 <br>
				
				</div>

				<div style="width:100%;height:15px;float:left;"><span></span></div>

				<div style="width:100%;height:1px;background:gray;float:left;"><span></span></div>
				<div style="width:100%;height:2px;background:#ffffff;float:left;"><span></span></div>

				<div style="width:100%;height:15px;float:left;"><span></span></div>
				<br/>



				<div style="width:30px;height:30px;float:left;">5</div>
				<div style="width:600px;float:left;">
					종종 술을 드시거나 담배를 피시나요?<br>
					<br>
					<input type="radio" name="q7" id="q7" <? if ($row[6]=="Y") echo "checked"; ?>> 예 <br>
					<input type="radio" name="q7" id="q7" <? if ($row[6]=="N") echo "checked"; ?>> 아니오 <br>
					<br>
					일주일에 소주 
						<select name='q7_1' id='q7_1'>
						<?
							for($i=0;$i<=30;$i++)
							{
								if($i==$row[7])
									echo "<option value='$i' selected>$i</option>";
								else
									echo "<option value='$i'>$i</option>";
							}
						?>
						</select>
						잔<br>
					<br/>

					담배 하루에 
						<select name='q7_2' id='q7_2'>
						<?
							for($i=0;$i<=30;$i++)
							{
								if($i==$row[8])
									echo "<option value='$i' selected>$i</option>";
								else
									echo "<option value='$i'>$i</option>";
							}
						?>
						</select>
						개피<br>

				
				</div>

				<div style="width:100%;height:15px;float:left;"><span></span></div>

				<div style="width:100%;height:1px;background:gray;float:left;"><span></span></div>
				<div style="width:100%;height:2px;background:#ffffff;float:left;"><span></span></div>

				<div style="width:100%;height:15px;float:left;"><span></span></div>


				
				
				
				<div style='width:100%;height:30px;padding-left:30px;float:left;'>
						<a  onclick="value_save();" style="cursor:pointer"><img src='./img/ndd_talk_save.png' border="0"></a>&nbsp;<a style='cursor:pointer;' onclick='history.back();'><img src='./img/ndd_talk_cancel.png' border="0"></a>
						
				</div>
				
				
			
			</div>
			<? include "footer.php";?>		
		</div>

		
		<iframe src='' name='ifr_temp' style='display:none;'></iframe>
		<iframe name="ifr_temp_status" src="_blank" style="display:none;"></iframe>

		<script>
			function div_expand()
			{
				if(q1[0].checked)
					div_q2.style.display="";
				else
					div_q2.style.display="none";
					

				if(q3[0].checked)
					div_q4.style.display="";
				else
					div_q4.style.display="none";
				
			
			}
			
			div_expand();
			
			function value_save()
			{
				result_str = "q1=";
				if(q1[0].checked)
					result_str += "Y";
				else if(q1[1].checked)
					result_str += "N";
					
				result_str += "&q2="+q2.value;
				
				result_str += "&q3=";
				if(q3[0].checked)
					result_str += "Y";
				else if(q3[1].checked)
					result_str += "N";
					
				result_str += "&q4="+q4.value;
				
				result_str += "&q5=";
				if(q5[0].checked)
					result_str += "Y";
				else if(q5[1].checked)
					result_str += "N";

				result_str += "&q6=";
				if(q6[0].checked)
					result_str += "Y";
				else if(q6[1].checked)
					result_str += "N";

				result_str += "&q7=";
				if(q7[0].checked)
					result_str += "Y";
				else if(q7[1].checked)
					result_str += "N";

				result_str += "&q7_1=";
				result_str += q7_1.value;
				result_str += "&q7_2=";
				result_str += q7_2.value;

				//alert(result_str);
				ifr_temp_status.location.href='ndd_my_info_basic_add.php?<? echo $url_args;?>&' + result_str;
			}
		</script>	
	</div>
 </body>
</html>
